<template>
  <div id="translateForm" class="container" style="margin-top: 10px">
      <form id="transForm" class="well form-inline row " style="margin-top: 20px;margin-left: 20px ;border: none" v-on:submit="formSubmit">
        <textarea class="col-md-10" style ='margin-left: 8% ;height:200px; padding-left: 2% ;border-radius: 5px; border: 1px solid #DCDCDC'  v-model="textToTranslate" placeholder="输入需要翻译的内容"></textarea>
        <div class="col-md-10" style="margin-top: 50px;margin-left: 5% ;">
          <select class="col-md-1" style ='padding-left: 2% ; padding-right: 1% ; border-radius: 5px; margin-left: 20px ;border: 1px solid #333333' v-model="language">
            <option value="zh">汉语</option>
            <option value="en">英语</option>
            <option value="ru">俄语</option>
            <option value="ja">日语</option>
            <option value="ko">韩语</option>
            <option value="fr">法语</option>
          </select>
          <input class="btn btn-primary col-md-1 " style ='margin-left: 20px;' type="submit" value="翻译">
        </div>
      </form>
    </div>
</template>

<script>


export default {
  name: 'translateForm',
  data:function(){
    return {
      textToTranslate:"",
      language:""
    }
  },
  methods: {
    formSubmit:function(e){
      // alert(this.textToTranslate);
      this.$emit("formSubmit",this.textToTranslate,this.language);
      e.preventDefault();
    }
  },
  created:function(){
    this.language = "en";
  }
}
</script>

<style>
  #transForm{
    border-radius: 10px;
    border: 1px #ccc solid;
  }
</style>
